/***
 *                    _ooOoo_
 *                   o8888888o
 *                   88" . "88
 *                   (| -_- |)
 *                    O\ = /O
 *                ____/`---'\____
 *              .   ' \\| |// `.
 *               / \\||| : |||// \
 *             / _||||| -:- |||||- \
 *               | | \\\ - /// | |
 *             | \_| ''\---/'' | |
 *              \ .-\__ `-` ___/-. /
 *           ___`. .' /--.--\ `. . __
 *        ."" '< `.___\_<|>_/___.' >'"".
 *       | | : `- \`.;`\ _ /`;.`/ - ` : | |
 *         \ \ `-. \_ __\ /__ _/ .-` / /
 * ======`-.____`-.___\_____/___.-`____.-'======
 *                    `=---='
 *
 * .............................................
 *          佛祖保佑             永无BUG
 *@author wwh
 *@date 2022年07月20日19:16
 */
package com.bm.server.service.impl;


import com.bm.server.dto.UinfoDto;
import com.bm.server.vo.R;
import com.bm.server.dao.UserInfoDao;
import com.bm.server.service.intf.MyInfoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class MyInfoServiceImpl implements MyInfoService {
    @Resource
    private UserInfoDao userInfoDao;
    @Override
    public UinfoDto selectAll(Integer uid) {
        return userInfoDao.selectAll(uid);
    }

    @Override
    public R updateUserInfo(UinfoDto dto) {
        if (dto != null){
            int i = userInfoDao.updateUserInfo(dto.getUid(), dto.getNickName(), dto.getHeadurl(), dto.getBirthday(), dto.getSex(), dto.getHometown(),
                    dto.getOccupation(), dto.getSignature(), dto.getLabel());
            if (i>0){
                return R.ok();
            }
        }
        return R.fail();
    }
}
